#include <tsubamegaeshi-base/worldmodel.h>

#include <iostream>

Worldmodel::Worldmodel(const std::string& teamname)
  :Parser(), teamname_(teamname), step_(0)
{
}

Worldmodel::~Worldmodel()
{
}

const std::string&
Worldmodel::teamname()
{
  return teamname_;
}

const int
Worldmodel::side()
{
  return side_;
}

const int
Worldmodel::number()
{
  return number_;
}

Worldmodel::TStatus&
Worldmodel::current_status()
{
  return status_[step_ % HISTORY_MAX];
}

const Worldmodel::TStatus&
Worldmodel::status_history(int i)
{ 
  if (i > (HISTORY_MAX - 1)) {
    i = HISTORY_MAX - 1;
  } else if (i > step_) {
    i = step_;
  } else if (i < 0) {
    i = 0;
  }

  return status_[(step_ - i) % HISTORY_MAX];
}
